﻿@{
    ViewBag.Title = "BalanceCustomer";
}

@{
    ViewBag.Title = "BalanceSupplier";
}
@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>       
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}

<div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;">                
    <table width = "1000px;">
    <tr>
    <td width = "1000px;">
        <a class="mini-button" iconCls="icon-search" onclick="search" plain="true">刷新</a>
        <span class="separator"></span>
        <a class="mini-button" iconCls="icon-node" onclick="clear" plain="true">重置</a>
        <span class="separator"></span>
        <a class="mini-button" id="export" iconCls="icon-expand" onclick="setExportExcel('datagrid1')" plain="true">导出</a>
        <a class="mini-button" id="print" iconCls="icon-print" onclick="printdata" plain="true">打印</a>
        <span class="separator"></span>
        <a class="mini-button" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
    </td>
    </tr>
    </table>                
</div>
<table>
    <tr>
        <td width ="70px" align="right"><span class="abc">分店名称：</span></td>
        <td width ="200px">
            @Html.Partial("~/Views/Delivery/LookupStockRelevant.cshtml")
        </td>
        <td width ="70px" align="right"></td>
        <td width ="190px" align="right">
        </td>
    </tr>
</table>
    <div class="mini-fit">
     <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" 
                borderStyle="border:1;"pageSize="15" url="GetBalanceShop"
                allowCellSelect="true" allowCellEdit="true" fitColumns="false" showSummaryRow="true" 
                ondrawsummarycell="onDrawSummaryCell" onrowdblclick="edit">
            <div property="columns">
                <div type="checkcolumn" ></div>
                <div type="indexcolumn" width="40" headerAlign="center" >序号</div>
                <div field="FDate" name="FDate" width="100" headeralign="center" allowsort="true" dateFormat="yyyy-MM-dd">统计日期</div>
                <div field="FNumber" name="FNumber" width="100" headeralign="center" allowsort="true">分店编码</div>
                <div field="FName" name="FName" width="150" headeralign="center" allowsort="true">分店名称</div>
                <div field="FTelephone" name="FTelephone" width="120" headeralign="center" allowsort="true">联系电话</div>
                <div field="FManage" name="FManage" width="80" headeralign="center" allowsort="true">联系人</div>
                <div field="FBalanceAmt" name="FBalanceAmt" width="80" headeralign="center" allowsort="true" align="right" numberFormat="#,0.00">期末余额</div>
                <div field="FRemark" name="FRemark" width="150" headeralign="center" allowsort="true">备注</div>                
            </div>
       </div>  
    </div>

<script>
    var sumFields = "FBalanceAmt";
    mini.parse();

    function FormShown() {
        LoadListData();
    }

    function LoadListData() {
        var grid = mini.get("datagrid1");
        var sSystemAppID = parent.window.getSystemAppID();
        var json = "[{";
        json = json + "'FSystemAppID':" + "'" + sSystemAppID + "',";
        json = json + "'FCustID':'" + mini.getbyName("FRStockID").getValue() + "'}]";
        var grid = mini.get("datagrid1");
        grid.load({ mydata: json });

        mExportDataUrl = grid.url;
        mExportDataJson = json;

    }
    function search() {
        LoadListData();
    }
    function clear() {
        mini.getbyName("FRStockID").setValue('');
        mini.getbyName("FRStockID").setText('');
        mini.getbyName("FRStockName").setValue('');
    }
    function printdata() {
        var grid = mini.get("datagrid1");
        var url = "../Report/PrintReport";
        mini.open({
            url: url,
            title: "打印", width: 1000, height: 700,
            onload: function () {
                var iframe = this.getIFrameEl();
                var NoneDisplayCol = [0];
                iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, "分店余额表");
            }
        });
    }

</script>